function PointMass(cx, cy, mass) {
  this.cur = new Vector(cx, cy);
  this.prev = new Vector(cx, cy);
  this.mass = mass;
  this.force = new Vector(0.0, 0.0);
  this.result = new Vector(0.0, 0.0);
  this.friction = 0.01;
};

PointMass.prototype.getPos = function() {
  return this.cur;
};

PointMass.prototype.getPrevPos = function() {
  return this.prev;
};

PointMass.prototype.setForce = function(force) {
  this.force.set(force);
};

PointMass.prototype.addForce = function(force) {
  this.force.add(force);
};

PointMass.prototype.getMass = function() {
  return this.mass;
};

PointMass.prototype.setMass = function(mass) {
  this.mass = mass;
};

PointMass.prototype.setPos = function(x, y) {
  this.prev.setX(x);
  this.prev.setY(y);
  this.cur.setX(x);
  this.cur.setY(y);
};

PointMass.prototype.update = function(dt) {
  var t, a, c, dtdt;

  dtdt = dt * 0.01;
  dtdt = dtdt * dtdt;

  a = this.force.getX() / this.mass;
  c = this.cur.getX();
  t = (2.0 - this.friction) * c - (1.0 - this.friction) * this.prev.getX() + a * dtdt;
  this.prev.setX(c);
  this.cur.setX(t);

  a = this.force.getY() / this.mass;
  c = this.cur.getY();
  t = (2.0 - this.friction) * c - (1.0 - this.friction) * this.prev.getY() + a * dtdt;
  this.prev.setY(c);
  this.cur.setY(t);
};

PointMass.prototype.setFriction = function(friction) {
  this.friction = friction;
};

PointMass.prototype.getVelocity = function() {
  var cXpX, cYpY;

  cXpX = this.cur.getX() - this.prev.getX();
  cYpY = this.cur.getY() - this.prev.getY();

  return cXpX * cXpX + cYpY * cYpY;
};

PointMass.prototype.draw = function(ctx) {
  ctx.lineWidth = 5;
  ctx.fillStyle = '#ff0000';
  ctx.strokeStyle = '#ffffff';
  ctx.beginPath();
  ctx.arc(this.cur.getX(), this.cur.getY(), 6.0, 0.0, Math.PI * 2.0, true);
  ctx.fill();
};
